/**
 * 
 */
package com.softme.trade.model.dao;

import java.io.Serializable;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.softme.trade.model.Firm;

/**
 * @author meyer
 *
 */
public class FirmDAO  extends HibernateDaoSupport implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public Firm findByName(String value)
	{
		String query = "from Role where name = :value";

		@SuppressWarnings("unchecked")
		List<Firm> result = this.getHibernateTemplate().findByNamedParam(query, "value", value);
		
		if (result != null && result.size() > 0)
			return result.get(0);
		
		return null;
	}
	
	public List<Firm> loadAll()
	{
		return getHibernateTemplate().loadAll(Firm.class);
	}

	public Firm load(Long id)
	{
		return getHibernateTemplate().get(Firm.class, id);
	}

	public void saveOrUpdate(Firm Firm)
	{
		getHibernateTemplate().saveOrUpdate(Firm);
	}
	
	public void save(Firm Firm)
	{
		getHibernateTemplate().save(Firm);
	}

	public void delete(Firm Firm)
	{
		getHibernateTemplate().delete(Firm);
	}
}
